<?php

//No direct access

defined('_JEXEC') or die('Restricted access');

?>

<div id="ownservices">

 
 <div id="mainmenuownservice"><?php echo MenuHelper::nav(); ?></div>

<div id="mainownservice">

<h3><?php echo JText::_('OWNSERVICE_BRANCHES'); ?></h3>

<hr />

<?php if($this->access->canAdd): ?>
<div id="toolbar">
	<a class="toolbar" onclick="javascript: submitbutton('add')" href="#">
		<span title="<?php echo JText::_('OWNSERVICE_NEW_BRANCH'); ?>" class="icon-32-new"></span>
		<?php echo JText::_('OWNSERVICE_NEW_BRANCH'); ?>
	</a>
</div>
<div class="clear"> </div>
<?php endif; ?>

<form action="<?php echo JRoute::_('index.php?option=com_ownservice'); ?>" method="post" name="adminForm">

	<table>

		<tr>

			<td width="100%">

				<?php echo JText::_( 'OWNSERVICE_FILTER' ); ?>:<input type="text" name="search" value="<?php echo htmlspecialchars($this->lists['search']);?>"  onchange="document.adminForm.submit();" />

				<button onclick="this.form.submit();" class="button"><?php echo JText::_( 'Go' ); ?></button>

				<button onclick="document.adminForm.search.value='';this.form.submit();" class="button"><?php echo JText::_( 'Reset' ); ?></button>

			</td>

			<td nowrap="nowrap">

			</td>

		</tr>

	</table>

	<table class="adminlist" cellspacing="1">

		<tr>

			<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_BRANCHNAME', 'name', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>

			<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_BRANCH_CODE', 'code', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>

			<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_ADDRESS', 'address', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>

			<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_CITY', 'city', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>

			<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_STATE', 'state', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>

			<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_POSTCODE', 'postcode', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>

			<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_SELECT_ACTION'); ?></td>

		</tr>

		<tfoot>

			<tr>

			  <td colspan="7"><?php echo $this->pageNav->getListFooter(true); ?></td>

			</tr>

		</tfoot>

		<tbody>

		<?php

			$k = 0;

			for($i=0,$n=count($this->rows);$i<$n;$i++): 

			$row = $this->rows[$i];

		?>

		<tr class="<?php echo "row$k"; ?>">

			<td class="inner_tablelist"><?php echo $row->name; ?></td>

			<td class="inner_tablelist"><?php echo $row->code; ?></td>

			<td class="inner_tablelist"><?php echo $row->address; ?></td>

			<td class="inner_tablelist"><?php echo $row->city; ?></td>

			<td class="inner_tablelist"><?php echo $row->state; ?></td>

			<td class="inner_tablelist"><?php echo $row->postcode; ?></td>

			<td class="inner_tablelist" align="center">

				<select class="inputbox" name="action" id="action" onChange="listTaskAction(<?php echo $row->id ?>,this.value);">

					<option value="" selected><?php echo JText::_('OWNSERVICE_PLEASE_SELECT'); ?></option>

					<?php if($this->access->canView) : ?><option value="detail"><?php echo JText::_('OWNSERVICE_VIEW');?></option><?php endif; ?>

					<?php if($this->access->canEdit) : ?><option value="edit"><?php echo JText::_('OWNSERVICE_EDIT');?></option><?php endif; ?>

					<?php if($this->access->canDelete) : ?><option value="delete"><?php echo JText::_('OWNSERVICE_DELETE');?></option><?php endif; ?>

				</select>

			</td>

		</tr>

		<?php $k = 1 - $k; endfor; ?>

		</tbody>

	</table>

	<input type="hidden" name="id" value="" />

	<input type="hidden" name="option" value="com_ownservice" />

	<input type="hidden" name="task" value="" />

	<input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid'); ?>" />

	<input type="hidden" name="controller" value="branch" />

	<input type="hidden" name="view" value="branches" />

	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />

	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />

	<?php echo JHTML::_( 'form.token' ); ?>

</form>

</div>

</div>